package org.interview.ms.array.linkedlist;

import java.util.LinkedList;

public class AscendingOrderInsertToLinkedList {

	public static void main(String[] args) {

		Integer intial01 = 1;
		Integer intial02 = 2;
		Integer intial03 = 3;

		Integer elem01 = 777;
		
		LinkedList<Integer> linkedList = new LinkedList<Integer>();

		linkedList.add(intial01);
		linkedList.add(intial02);
		linkedList.add(intial03);
		
		insertUsingAscOrder(linkedList, elem01);

		System.out.println(linkedList);
	}

	public static void insertUsingAscOrder(LinkedList<Integer> linkedList,
			Integer element) {

		if (linkedList == null) {
			return;
		}
		linkedList.add(0, element);
		//linkedList.addFirst(element);
	}

}
